import urllib.request as ur
import urllib.parse as up
# 'https://tieba.baidu.com/f?'

data = {
    'kw':'美剧',
    'ie':'utf-8',
    'pn':50
}
# 进行加密
data_parse = up.urlencode(data)
# print(data_parse)
# 调用request拼接
request = ur.Request('https://tieba.baidu.com/f?'+data_parse)
# 用urlopen打开request
response = ur.urlopen(request).read()
with open("meijutest.html",'wb') as f :
    f.write(response)